﻿using System.Windows;
using System.Windows.Controls;

using Aliphant.Mvvm.XEvent.Events;
using Aliphant.UI;
using Aliphant.Widget.JS.Utility;

namespace Aliphant.Widget.JS.Views
{
    /// <summary>
    /// MainPage.xaml 的交互逻辑
    /// </summary>
    public partial class MainPage : UserControl, IPage
    {
        private WindowEvent _windowEvent;

        public MainPage()
        {
            InitializeComponent();
            _windowEvent = WidgetCenterModule.EventAgent.GetEvent<WindowEvent>();
        }

        public void Close()
        {
            _windowEvent.Publish(new WindowEvent
            {
                Type = EventType.Action,
                WindowActionType = WindowActionType.Close,
                EventId = EventIds.Release
            });
        }
    }
}
